<?php

namespace Modules\Log\Entities;

use Modules\Core\Entities\BaseEntity as Model;
use ThrowException;

// use Modules\Core\Traits\Likeable;

class AdminLog extends Model
{
	// use Likeable;

    protected $guarded = [];
    protected $table = 'log_admin_logs';

    protected $appends = ['action_type_key'];

    static public $resourceName = '管理后台关键操作的日志记录';

    protected $casts = [
        'options' => 'json'
    ];

    // 记录日志
    static public function log($info) 
    {
        return self::create($info);
    }

    // 
    public function getActionTypeKeyAttribute()
    {
        $map = [
            1 => 'update_fudai_lucky_score'      // 更新福袋欧气值
        ];

        return @v($map[$this->action_type], 'unknow');
    }
}
